package cn.ultrarisk.scadmin.manager.biz.solr.factory;

import org.apache.solr.client.solrj.impl.CloudSolrServer;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

/**
 * CloudSolrServerFactory
 *
 * @author sevendlong(lin23871@163.com)
 * @date 2014/6/17
 * @since V1.0
 */
@Component
public class CloudSolrServerFactory {
    @Value("${zk.host}")
    private String zkHost;
    @Value("${zk.clientTimeout}")
    private Integer zkClientTimeout;
    @Value("${zk.connectTimeout}")
    private Integer zkConnectTimeout;

    public CloudSolrServer getServer() {
        CloudSolrServer server = new CloudSolrServer(zkHost);
        server.setZkClientTimeout(zkClientTimeout);
        server.setZkConnectTimeout(zkConnectTimeout);
        return server;
    }
}
